{if $lienUtile->lien_statut == '1'} {assign $oui = "CHECKED"}{else}{assign $oui = ""}{/if}
{if $lienUtile->lien_statut == '0'} {assign $non = "CHECKED"}{else}{assign $non = ""}{/if}

<div id="main_container">

	{$oZoneHeader}
    
    <div class="main_content">
        {$oZoneTopMenu}
        <div class="center_content">  
            <div class="left_content">
                {$oZoneLeftMenu}
            </div>
    
            <div class="right_content">
                {if $lienUtile->lien_id}
                    <h2>Editer un lien</h2> 
                {else}
                    <h2>Ajouter un lien</h2> 
                {/if}
                    
                <form action="{jurl 'lienUtile~BoLienUtile:sauvegarder'}" method="post" id="editCompte" enctype="multipart/form-data">
                    <input type="hidden" name="id" value="{$lienUtile->lien_id}" />
                    <dl>
                		<dt><label>Catégorie : </label></dt>
                 		<dd>
                            <select name="categorie">
                                {foreach $categorie as $categorieItem}
                                    {if $categorieItem->cat_id == $lienUtile->lien_cat_id}
                                        {assign $selected = "selected='selected'"}
                                    {else}
                                        {assign $selected = ""}
                                    {/if}
                                    <option value="{$categorieItem->cat_id}" {$selected}>{$categorieItem->cat_name}</option>
                                {/foreach}
                            </select>
                        </dd>
              		</dl>
                     <dl>
                		<dt><label>Lien *: </label></dt>
                 		<dd><input type="text" name="lien" value="{$lienUtile->lien_url}" validation="required"/></dd>
              		</dl>
                     <dl>
                		<dt><label>Titre *: </label></dt>
                 		<dd><input type="text" name="titre" value="{$lienUtile->lien_titre}" validation="required"/></dd>
              		</dl>
                   
                     <dl style="height:auto;">
                		<dt><label>Photographie : </label></dt>
                 		<dd><input type="file" name="photo" value="{$lienUtile->lien_photo}" /></dd>
                        
              		</dl>
                        {if $lienUtile->lien_id}
                            {assign $pathImageLienUtile = PATH_UPLOAD_LIEN_UTILE}
                 		    <img src="{$pathImageLienUtile}{$lienUtile->lien_photo}" alt="{$lienUtile->lien_titre}" width="90" height="60" style="margin-left:155px;"/>
                            <input type="hidden" name="photoOld" value="{$lienUtile->lien_photo}" />
                        {/if}

                     <dl style="height:auto">
                    <dt><label>Texte : </label></dt>
                    <dd style="width:600px;">
                        <textarea id="content" name="content" >{$lienUtile->lien_texte}</textarea>
                        <script type="text/javascript">
                            {literal}CKEDITOR.replace( 'content', {width:'600px', toolbar:'AOToolbar'}) ;{/literal}
                        </script>
                    </dd>
                    </dl>

                    <dl>
                		<dt><label class="nPadd">Statut : </label></dt>
                 		<dd>
                            <input type="radio" name="statut" value="1" {$oui}/> Activé
                            <input type="radio" name="statut" value="0" {$non}/> Désactivé
                        </dd>
              		</dl>
                    <dl class="submit">
                        <input class="valider" title="Valider" type="submit" value="" />
                 		<a title="Annuler" href="{jurl 'lienUtile~BoLienUtile:index'}" class="bt_green"><span class="bt_green_lft"></span><strong>Annuler</strong><span class="bt_green_r"></span></a>
                    </dl>
                  
                 </form>

            </div><!-- end of right content-->
        </div>   <!--end of center content -->               

        <div class="clear"></div>
    </div> <!--end of main content-->
	
    
    <div class="footer">
    </div>

</div>
{literal}
    <style type="text/css">
        p label {width:400px;margin-right:20px;}
        p span {float:right;margin-right:350px;}
    </style>
    <script type="text/javascript">
        $(function () {
            $('#submitCompte').bind('click', function () {
                $("#editCompte").submit();
            });
        });
         

        // form validation
        var demoForm = $("#editCompte");
        demoForm.validation();
        demoForm.submit(function(e) {

            $("#valid-form").remove();
            if(demoForm.validate()) {
                document.forms["editCompte"].submit();
            }
            e.preventDefault();
        });
    </script>
{/literal}
